import React, {Component} from 'react';
import Son from "@/Context/Son";
import {Provider} from "@/Context/myContext";

class Index extends Component {

  state = {
    msg: '我是爸爸'
  }

  changeMsg = (msg) => () => this.setState({msg})


  render() {
    return (<div>
      <h3>我是父组件: {this.state.msg}</h3>
      <hr/>
      <Provider value={{msg: this.state.msg, age: 18, changeMsg: this.changeMsg}}>
        <Son/>
      </Provider>
    </div>);
  }
}

export default Index;
